﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace OOAD_Project_Engine.Foundation
{
  public  class Graphic
    {


        public static void DrawTexture(SpriteBatch spriteBatch, Texture2D Texture)
        {
            DrawTexture(spriteBatch, Texture, Vector2.Zero, Color.White, 1, 0, Vector2.Zero, new Vector2(1), SpriteEffects.None, Matrix.Identity);
        }
        
        public static void DrawTexture(SpriteBatch spriteBatch, Texture2D Texture,Vector2 Origin, Matrix Projection)
        {
            DrawTexture(spriteBatch, Texture, Vector2.Zero, Color.White, 1, 0,Origin, new Vector2(1), SpriteEffects.None, Projection);
        }

        public static void DrawTexture(SpriteBatch spriteBatch, Texture2D Texture, Rectangle source, Vector2 Position, Vector2 Origin, Matrix Projection)
        {
            //DrawTexture(spriteBatch, Texture, Vector2.Zero, Color.White, 1, 0, Origin, new Vector2(1), SpriteEffects.None, Projection);
            DrawTexture(spriteBatch, Texture, source, Position, Color.White, 1, 0, Origin, new Vector2(1), SpriteEffects.None, Projection);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Origin">in pixal</param>
        public static void DrawTexture(SpriteBatch spriteBatch, Texture2D Texture, Vector2 Position, Color Color, float Alpha, float Rotation, Vector2 Origin, Vector2 Scale, SpriteEffects SpriteEffects, Matrix Projection)
        {
            //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Projection);
            //spriteBatch.Draw(Texture, Position, null, Color * Alpha, Rotation, Origin, Scale, SpriteEffects, 0);
            //spriteBatch.End();
            DrawTexture(spriteBatch, Texture,null ,Position, Color, Alpha, Rotation, Origin, Scale, SpriteEffects, Projection);
        }

        public static void DrawTexture(SpriteBatch spriteBatch, Texture2D Texture,Rectangle? source ,Vector2 Position, Color Color, float Alpha, float Rotation, Vector2 Origin, Vector2 Scale, SpriteEffects SpriteEffects, Matrix Projection)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Projection);
            spriteBatch.Draw(Texture, Position, source, Color * Alpha, Rotation, Origin, Scale, SpriteEffects, 0);
            spriteBatch.End();
        }

    }
}
